/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 *
 * @author Nicolas
 */
public class CreateAdvice extends javax.swing.JFrame {

    private HPVAS gfather;
    
    public CreateAdvice(HPVAS gfather) {
        initComponents();
        this.gfather = gfather;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        go_button = new javax.swing.JButton();
        option_text = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMaximumSize(new java.awt.Dimension(174, 82));
        setMinimumSize(new java.awt.Dimension(174, 82));

        jLabel1.setText("What do you want to create?");

        go_button.setText("Create");
        go_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                go_buttonActionPerformed(evt);
            }
        });

        option_text.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Veterinarian", "Pet", "Owner" }));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(option_text, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(go_button))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(go_button)
                    .addComponent(option_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void go_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_go_buttonActionPerformed
        System.out.println(option_text.getItemAt(option_text.getSelectedIndex()).toString().trim());
        switch(option_text.getItemAt(option_text.getSelectedIndex()).toString()){
            case "Veterinarian":
                gfather.setCurrent_panel(new VeterinarianCreatePanel(gfather));
                gfather.change_panel();
                break;
            case "Owner":
                gfather.setCurrent_panel(new OwnerCreatePanel(gfather));
                gfather.change_panel();
                break;
            case "Pet":
                gfather.setCurrent_panel(new PetCreatePanel(gfather));
                gfather.change_panel();
                break;
        }
        this.setVisible(false);
            
    }//GEN-LAST:event_go_buttonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton go_button;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JComboBox option_text;
    // End of variables declaration//GEN-END:variables
}
